package com.devops.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.devops.admin.model.DOSProjectEnvClusterNamespaceRelation;
import com.devops.admin.po.DOSProjectEnvClusterNamespaceRelationPo;
import com.devops.admin.po.DOSProjectEnvTypePo;
import com.devops.admin.po.DOSProjectEvnClusterPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ClassName DOSProjectEnvClusterNamespaceRelationMapper
 * @Description TODO
 * @Author hepingguo
 * @Date 2022/6/20 17:50
 **/
@Mapper
public interface DOSProjectEnvClusterNamespaceRelationMapper extends BaseMapper<DOSProjectEnvClusterNamespaceRelation> {

    /**
     * @Author heyabo
     * @Description 根据项目id查询项目的授权信息
     * @Date 11:02 2022/6/21
     * @Param [projectId]
     * @return java.util.List<com.devops.admin.po.DOSProjectEvnClusterPo>
     **/
    List<DOSProjectEvnClusterPo> selectAuthorized(Integer projectId);

    /**
     * @Author heyabo
     * @Description 根据项目id集合查询环境和集群集合
     * @Date 15:35 2022/6/23
     * @Param [projectIds]
     * @return java.util.List<com.devops.admin.po.DOSProjectEvnClusterPo>
     **/
    List<DOSProjectEvnClusterPo> selectEnvClusters(List<Integer> projectIds);

    /**
     * @Author heyabo
     * @Description 获取可选的环境类型
     * @Date 15:00 2022/6/30
     * @Param [projectId]
     * @return com.devops.admin.po.DOSProjectEnvTypePo
     **/
    List<DOSProjectEnvTypePo> selectEnvType(Integer projectId);

    /**
     * 根据projectId 和 envType 获取项目授权的集群命名空间信息
     * @param projectId
     * @param envType
     * @return
     */
    List<DOSProjectEnvClusterNamespaceRelationPo> getClusterNamespaceByProjectIdAndEnvType(@Param("projectId") Integer projectId, @Param("envType") Integer envType);
}
